package com.ydd.controller.admin;

import com.ydd.dto.AdvposDTO;
import com.ydd.dto.AdvposdPageDTO;
import com.ydd.result.Result;
import com.ydd.service.YddAdvposService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Api(tags = "后台广告位")
@RequestMapping("/ydd_advpos")
public class AdvposController {

    @Autowired
    private YddAdvposService advposService;

    /**
     * 广告位列表-分页
     *
     * @return
     */

    @GetMapping("/list")
    public Result findList(AdvposdPageDTO dto) {

        return advposService.findList(dto);
    }

    /**
     * 根据id查询广告
     *
     * @return
     */
    @GetMapping("/rowInfo")
    public Result selectByAdvposId(Long id) {

        return advposService.selectByAdvposId(id);
    }

    /**
     * 广告修改
     *
     * @return
     */
    @PostMapping("/update")
    public Result updateAdvpos(@RequestBody AdvposDTO dto) {

        return advposService.updateAdvpos(dto);
    }

    /**
     * 广告位删除
     * @return
     */
    @GetMapping("/del")
    public Result delAdvpos(Long id){

        return  advposService.delAdvpos(id);

    }

    /**
     * 广告位添加
     * @return
     */
    @PostMapping("/add")
    public Result addAdvpos(@RequestBody AdvposDTO dto){

        return advposService.addAdvpos(dto);

    }

    /**
     * 广告位列表
     * @return
     */
    @GetMapping("/all")
    public Result all(){
        return advposService.all();

    }


}
